from handler_helpers.base_handler_helper import BaseHandlerHelper
from utils.check_params_utlil import CheckParams
from utils.verify_func_util import VerifyFunc


class BatchDeleteHandlerHelper(BaseHandlerHelper):
    def batch_delete_handler(self):
        check_r = CheckParams(params=self.request.request_data,
                              conditions=[["guid_list", True, [], [[VerifyFunc.is_list]]],
                                          ["is_delete", False, 1]]).check()
        if not check_r.is_success:
            return self._failure_response(message=check_r.message)
        res = self.bll_cls(request=self.request, cls=self.cls, unique_fields=self._get_unique_fields).\
            batch_delete(check_r.data['guid_list'], check_r.data['is_delete'])
        return self._response(res)
